﻿using SYJ.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace SYJ.Common.web
{
   public class JsonLayuiGridData<T> where T:new ()
    {
      
       public long code { get; set; }

       public string msg { get; set; }
       public long count { get; set; }

       public IList<T> data { get; set; }

       private JsonLayuiGridData() {
           this.data = new List<T>();
       }
      
    /// <summary>
    /// 生成Json
    /// </summary>
    /// <param name="sm"></param>
    /// <param name="responseData"></param>
    /// <param name="total"></param>
    /// <returns></returns>
       public static JsonLayuiGridData<T> Create(QueryModel sm, IList<T> responseData, long total, string msg)
       {
           if (null == sm)
               throw new ArgumentNullException("sm");
           if (null == responseData)
               throw new ArgumentNullException("responseData");
           JsonLayuiGridData<T> json = new JsonLayuiGridData<T>();
           json.code = 0;
           json.count = total;
           json.msg = msg;
           json.data = responseData;
           return json;
       }
    }
}
